%\documentclass{article}
%\usepackage{tikz}
%
%\begin{document}\pagestyle{empty}
\documentclass{article}
 
\usepackage[pdftex,active,tightpage]{preview}
\usepackage{tikz}
\usetikzlibrary{snakes}
\usetikzlibrary{arrows}
\makeatletter
 
\begin{document}
\begin{preview}
	%%
	\begin{tikzpicture} [scale=0.9]
	
	\draw[very thin,color=gray] (-0.1,-0.1) grid (13,5);
	\draw[->] (-0.2,0) -- (13.2,0) node[right] {$p$};
	\draw[->] (0,-0.2) -- (0,5.2) node[above] {$seconds$};
	
	\foreach \pos/\lbl in {0.5/1,1.5/2,2.5/4,3.5/8,4.5/16,5.5/32,6.5/64,7.5/128,8.5/256,9.5/512,10.5/1024,11.5/2048,12.5/4096}
	\draw (\pos,0) -- (\pos,-0.1) (\pos cm,-2.5ex) node [anchor=base,fill=white,inner sep=1pt]  {\scriptsize \lbl};
	
	\draw[very thin,color=gray, xstep=1, ystep=0.5] (0, -1.5) grid (13,-0.5);
	\draw[fill=blue!50, fill opacity=0.5] (-3,-1.0) rectangle +(3,0.5);
	\draw (-1.5, -0.75) node {\scriptsize 4-way};
	
	\draw[fill=red!50, fill opacity=0.5] (-3,-1.5) rectangle +(3,0.5);
	\draw (-1.5, -1.25) node {\scriptsize Exhaustive};
	
	\draw (-2.5ex, 0 cm) node [anchor=base,fill=white,inner sep=1pt] {\scriptsize 0};
	
	\draw (-2.5ex, 1 cm) node [anchor=base,fill=white,inner sep=1pt] {\scriptsize 10};
	
	\draw (-2.5ex, 2 cm) node [anchor=base,fill=white,inner sep=1pt] {\scriptsize 20};
	
	\draw (-2.5ex, 3 cm) node [anchor=base,fill=white,inner sep=1pt] {\scriptsize 30};
	
	\draw (-2.5ex, 4 cm) node [anchor=base,fill=white,inner sep=1pt] {\scriptsize 40};
	
	\draw (-2.5ex, 5 cm) node [anchor=base,fill=white,inner sep=1pt] {\scriptsize 50};
	
	\newdimen\mypos
	\newdimen\myoff
	
	\foreach \pos/\vala/\valb in { 0/16.01/23.14, 1/23.57/31.99, 2/23.19/30.58, 3/25.16/33.36, 4/26.77/35.15, 5/28.99/38.60, 6/27.03/36.04, 7/29.52/38.99, 8/34.91/42.34, 9/35.56/42.75, 10/36.63/43.80, 11/38.23/46.77, 12/41.14/51.56} { 
	\mypos=\pos cm
	\advance \mypos by 0.5 cm
	\draw (\mypos, -0.75 cm) node {\scriptsize \vala};
	\draw (\mypos, -1.25 cm) node {\scriptsize \valb};
	
	\myoff=0 cm
	
	\advance \mypos by -0.25 cm
	\draw[fill=blue!50, fill opacity=0.5, yscale=0.098332040341349888] (\mypos,\myoff) rectangle +(0.25,\vala);
	\advance \mypos by 0.25 cm
	\draw[fill=red!50, fill opacity=0.5, yscale=0.098332040341349888] (\mypos,\myoff) rectangle +(0.25,\valb);
	\advance \mypos by 0.25 cm
	
	}
	
	\end{tikzpicture}%%
\end{preview}
\end{document}
%\end{document}
